import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class cusMain {
    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
        Cat myCat = new Cat("Tom");
        System.out.println("我家的小猫:"+myCat.name);
        for(Field field:myCat.getClass().getDeclaredFields()){
            if(field.isAnnotationPresent(greatString.class)){
                greatString gs = field.getAnnotation(greatString.class);
                System.out.println("可爱猫猫的昵称是："+gs.nickName());
            }
        }
        for(Method method : myCat.getClass().getDeclaredMethods()){
            if(method.isAnnotationPresent(cusAno.class)){
                cusAno ano = method.getAnnotation(cusAno.class);
               for(int i=0;i<ano.times();i++) {
                   method.invoke(myCat);
               }
            }
        }
    }
}
